package com.cjh.controller;

import com.cjh.pojo.Emp;
import com.cjh.service.EmpService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/consumer/api")
public class EmpController {

    @DubboReference
    private EmpService empService;

    private Logger logger = LoggerFactory.getLogger(EmpController.class);

    @GetMapping("/getById/{empId}")
    public Emp getById(@PathVariable Integer empId){

        Emp emp = empService.getById(empId);

        return emp;
    }

    @GetMapping("/listEmp")
    public List<Emp> listEmp(){

        List<Emp> emps = empService.linkedSelect();

        return emps;
    }

}
